package com.srd.phone.bean;


import com.srd.phone.utils.CommonUtils;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

public class RefundDetail {

    public String nm;
    public String numbersm;
    public int num;
    public String rstatem;
    public String rtime;

    public static List<RefundDetail> parseData(String json){
        List<RefundDetail> list = new ArrayList<RefundDetail>();
        try {
            JSONArray jsonArray = new JSONArray(json);
            for (int i = 0; i < jsonArray.length(); i++) {
                RefundDetail item = new RefundDetail();
                JSONObject jsonObject = jsonArray.getJSONObject(i);
                item.nm = jsonObject.optString("nm");
                item.numbersm = jsonObject.optString("numbersm");
                item.rstatem = jsonObject.optString("rstatem");
                item.num = jsonObject.optInt("num");
                item.rtime = CommonUtils.formatDataStr(jsonObject.optString("rtime"));
                list.add(item);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return list;
    }
}
